package com.pactera.domain;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import org.apache.log4j.Logger;

import com.pactera.consts.Const;
import com.pactera.db.OracleDb;
import com.pactera.db.PostgresDb;
import com.pactera.service.TimerService;

public class TestMain {

	private static Logger logger = Logger.getLogger(TestMain.class);
	
	public static void main(String[] args) throws Exception {
		
		String starttime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
		logger.info("--------------main方法开始("+starttime+")--------------");
		//初始化常量
		Const.initConfig();
		logger.info("开始初始化连接池");
		//初始化连接池
		PostgresDb.init();
		OracleDb.init();
////		测试oracle
//		String sql = "select * from demo_01";
//		Map<String,Object> map= OracleDb.query(sql, new MapHandler());
//		System.out.println(map.get("ID"));
//		System.out.println(map.get("name"));
////		测试postgres
//		String sql2 = "select * from cmr_ajf";
//		List<Map<String,Object>> list= PostgresDb.query(sql2, new MapListHandler());
//		System.out.println(list.size());
		//启动循环监测
		TimerService a =new TimerService();
		a.initType1();
		a.initType2();
		a.initType3();
		a.doEverydayTask();

		String b=".asd";
		String[] c =b.split("\\.");
		System.out.println(c[0]+"---"+c[1]);
		
//		boolean result = SmsService.sendSms(Const.SMS_WSDL,
//				Const.SMS_SP_CODE, Const.SMS_USER, Const.SMS_PWD,
//				Const.SMS_SI, "17735420070,15135157253", "测试短信2");
//		System.out.println(result);
		
		String endtime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
		logger.info("--------------main方法结束("+endtime+")--------------");
	}
}
